package com.gatewat.util;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.annotation.Configuration;


@RefreshScope
@Configuration
public class CodeFilter {

    private static String ignorePath;

    @Value(value = "${ignore.url:/api/oauth/login}")
    public void setIgnorePath(String ignorePath) {
        CodeFilter.ignorePath = ignorePath;
    }

    // public static String filterPath = "/api/oauth/login,/api/oauth/logout";
    public static boolean noHasAuthorize(String code) {

        String[] split = ignorePath.split(",");
        for (String value : split) {
            if (code.contains(value)) {
                return true;
            }
        }
        return false;
    }
}
